package com.paw.portal.response.dto;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import cn.hutool.core.date.DatePattern;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.paw.portal.enums.SysMenuEnums.HideChildrenInMenuEnum;
import com.paw.portal.enums.SysMenuEnums.HideInMenuEnum;
import com.paw.portal.enums.SysMenuEnums.MenuTypeEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 菜单权限表
 * </p>
 *
 * @author Rubble
 * @since 2021-08-21
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="SysMenuResponseDto对象", description="菜单权限表响应对象")
public class SysMenuResponseDto implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "菜单ID")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long id;


    @ApiModelProperty(value = "父菜单ID")
    @JsonSerialize(using= ToStringSerializer.class)
    private Long parentId;


    @ApiModelProperty(value = "菜单名称")
    private String name;


    @ApiModelProperty(value = "菜单类型（0：目录；1：菜单；2：按钮）")
    private Integer menuType;

    @ApiModelProperty(value = "菜单类型")
    private String menuTypeDesc;

    @ApiModelProperty(value = "路径")
    private String path;


    @ApiModelProperty(value = "隐藏菜单（0：否；1：是）")
    private Integer hideInMenu;

    @ApiModelProperty(value = "隐藏菜单")
    private String hideInMenuDesc;

    @ApiModelProperty(value = "隐藏子菜单（0：否；1：是）")
    private Integer hideChildrenInMenu;

    @ApiModelProperty(value = "隐藏子菜单")
    private String hideChildrenInMenuDesc;

    @ApiModelProperty(value = "权限标识")
    private String perms;


    @ApiModelProperty(value = "菜单图标")
    private String icon;


    @ApiModelProperty(value = "显示顺序")
    private Integer sortNum;


    @ApiModelProperty(value = "备注")
    private String remark;


    @ApiModelProperty(value = "创建者")
    private String createBy;


    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date createTime;


    @ApiModelProperty(value = "更新者")
    private String updateBy;


    @ApiModelProperty(value = "更新时间")
    @JsonFormat(pattern = DatePattern.NORM_DATETIME_PATTERN)
    private Date updateTime;

    @ApiModelProperty("子菜单")
    private List<SysMenuResponseDto> children;

        
  public String getMenuTypeDesc () {
    return MenuTypeEnum.getDescByCode(menuType);
  }
        
  public String getHideInMenuDesc () {
    return HideInMenuEnum.getDescByCode(hideInMenu);
  }
        
  public String getHideChildrenInMenuDesc () {
    return HideChildrenInMenuEnum.getDescByCode(hideChildrenInMenu);
  }
}
